#!/bin/bash
SAMBA_HOME=/etc/samba
log_path=/usr/local/samba/var
function start_samba(){
	sudo systemctl start smb
	sudo systemctl enable smb
	sudo systemctl start nmb
	sudo systemctl enable nmb
}
function stop_samba(){
	sudo systemctl stop nmb
	sudo systemctl stop smb

}
function restart_samba(){
	sudo systemctl restart nmb
	sudo systemctl restart smb

}

if [ ! -f ${SAMBA_HOME}/smb.conf ];then
   sudo cp smb.conf ${SAMBA_HOME}
fi   
if [ ! -d ${log_path} ];then
    sudo mkdir -p ${log_path}
    sudo chown ${USER}:${USER} -R ${log_path}
fi
stop_samba
start_samba 

